﻿///***************************************************************
/// 시  스  템 : Updms.Mny
/// 단위시스템 : MNY
/// 계      층 : Presentation Layer
/// 프로그램명 : Mny1010m
/// 파  일  명 : Mny1010m.aspx.cs
/// 설      명 : 은행계좌관리
///***************************************************************
/// 수정ID 일자       이름     내용
///---------------------------------------------------------------
/// CH001  2008-07-25 송시명   최초 작성
///***************************************************************
using System;
using System.Collections;
using System.Data;
using System.IO;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

using SMFramework.Adapter;
using SMFramework.Data;
using SMFramework.Security;
using SMFramework.Utility;
using SMFramework.Web.UI.WebControls.Page;
using SMFramework.Web.UI.WebControls.SMGridView;

using Base.AppFramework.Web.UI.CommandBar;
using Base.Dac;

using Updms.Common.BaseClass;
using Updms.Mny.Exe;


namespace Updms.Mny
{
	public partial class Mny1010m : Updms.Common.BaseClass.PageBase
	{
		#region 전역영역

		//프로그램상수
		public static readonly string PID = "Mny1010m";
		public static readonly string gs_path_info = "/updms/Mny/" + PID + ".aspx";

		Global global = new Global();
		Crypto crypto = new Crypto();
		CommCode.Com com = new CommCode.Com(LANG_SET);
		CommCode.Mny mny = new CommCode.Mny(LANG_SET);

		//페이징
		private int li_cur_page, li_row_count, li_st_page, li_ed_page;
		protected int li_page_size = GRID_PAGESIZE;// 한 페이지에 출력될 행의수

		//검색
		protected string kw1 = "";	//계좌명
		protected string kw2 = "";	//계좌번호
		protected string kw3 = "";	//예금주
		protected string kw4 = "";	//사용여부

		//메뉴 선택값
		protected string gs_sm = "";

		//페이지모드
		//private string gs_page_mode = "";

		#endregion

		#region Page_Load, OnPageLoad

		protected void Page_Load(object sender, EventArgs e)
		{
			SetInit();
			if (!Page.IsPostBack)
			{
				// 최초 화면 로딩시 처리해야 할 부분
				OnPageLoad();
				SelectProcess();
			}
		}

		// OnPageLoad
		private void OnPageLoad()
		{
			SetLiterals(global.GetLabelInfoByPgmId(PID, LANG_SET));
			SetClientScript();
			SetSearchUseYn();
			SetBnkCd();
			SetAccntCd();
			SetSearchParameter();
		}

		#endregion

		#region InitializeComponent

		private void InitializeComponent()
		{
			this.Load += new System.EventHandler(this.Page_Load);
			this.PreRender += new System.EventHandler(this.Page_PreRender);
		}

		#endregion

		#region SetClientScript

		private void SetClientScript()
		{
			//onKeyPress이벤트 (엔터검색)
			txt_search_accnt_nm.Attributes.Add("onkeypress", "enterSearch(event)");
			txt_search_accnt_num.Attributes.Add("onkeypress", "enterSearch(event)");
			txt_search_depositor.Attributes.Add("onkeypress", "enterSearch(event)");

			//달력콘트롤 설정
			ce_accnt_st_dt.SelectedDate = DateTime.Now.AddDays(0);
			ce_accnt_ed_dt.SelectedDate = DateTime.Now.AddDays(0);
		}

		#endregion

		#region SetInit, SetSearchParameter, ShowKeywordLabel

		//초기값설정
		private void SetInit()
		{
			lbl_search_flag.Text = "INIT";
			if (Request.QueryString["page"] == null || int.Parse(Request.QueryString["page"]) == 1)
			{
				li_cur_page = 1;
				li_st_page = 0;
				li_ed_page = li_page_size;
			}
			else
			{
				li_cur_page = int.Parse(Request.QueryString["page"]);
				li_st_page = (int.Parse(Request.QueryString["page"]) - 1) * li_page_size;
				li_ed_page = li_st_page + li_page_size;
			}

			gs_sm = (Request.QueryString["sm"] == null || Request.QueryString["sm"].Trim().Length != 7)
					? global.GetDirDepth(PID) : Request.QueryString["sm"].ToString();
		}

		//검색파라미터
		private void SetSearchParameter()
		{
			switch (lbl_search_flag.Text.Trim().ToUpper())
			{
				case "INIT":
					if (String.IsNullOrEmpty(Request.QueryString["kw1"]))	// url에 값이 없으면
					{
						kw1 = txt_search_accnt_nm.Text.Trim();
					}
					else
					{
						kw1 = Server.UrlDecode(Request.QueryString["kw1"]);
						txt_search_accnt_nm.Text = kw1;
					}

					if (String.IsNullOrEmpty(Request.QueryString["kw2"]))	// url에 값이 없으면
					{
						kw2 = txt_search_accnt_num.Text.Trim();
					}
					else
					{
						kw2 = Server.UrlDecode(Request.QueryString["kw2"]);
						txt_search_accnt_num.Text = kw2;
					}

					if (String.IsNullOrEmpty(Request.QueryString["kw3"]))	// url에 값이 없으면
					{
						kw3 = txt_search_depositor.Text.Trim();
					}
					else
					{
						kw3 = Server.UrlDecode(Request.QueryString["kw3"]);
						txt_search_depositor.Text = kw3;
					}

					if (String.IsNullOrEmpty(Request.QueryString["kw4"])) // url에 값이 없으면
					{
						kw4 = ddl_search_use_yn.SelectedValue;
					}
					else
					{
						kw4 = Server.UrlDecode(Request.QueryString["kw4"]);
						ddl_search_use_yn.SelectedValue = kw4;
					}
					break;
				case "SEARCH":
					kw1 = txt_search_accnt_nm.Text.Trim();
					kw2 = txt_search_accnt_num.Text.Trim();
					kw3 = txt_search_depositor.Text.Trim();
					kw4 = ddl_search_use_yn.SelectedValue;
					break;
			}
		}

		//검색키워드
		private void ShowKeywordLabel()
		{
			string ls_kw4 = ConversionUtil.CompareReplace(ddl_search_use_yn.SelectedItem.Text, DDL_SELECT, "-");
			lbl_search_keyword.Text = kw1 + " / " + kw2 + " / " + kw3 + " / " + ls_kw4;
		}

		#endregion

		#region 마스터 Method (SetSearchUseYn)

		//사용여부
		private void SetSearchUseYn()
		{
			com.SetUseYn(ddl_search_use_yn);
			com.SetUseYn(rbl_use_yn);

			ddl_search_use_yn.Items.Insert(0, new ListItem(DDL_SELECT, ""));
		}

		#endregion

		#region 디테일 Method (SetBnkCd, SetAccntCd, CreateFileReal)

		//은행코드
		private void SetBnkCd()
		{
			mny.SetBnkCd(ddl_bnk_cd);
		}

		// 계좌코드
		private void SetAccntCd()
		{
			mny.SetAccntCd(ddl_accnt_cd);
		}

		//실제파일생성
		private void CreateFileReal(string ls_file_nm, DataSet ds)
		{
			try
			{
				string tableName = "UPDMS_MNY_BNK_ACCNT_INFO";
				string ls_stream = FILE_PATH_FTP_UPLOAD + "\\" + ls_file_nm;
				FileInfo file = new FileInfo(ls_stream);

				StreamWriter sw = file.CreateText();

				sw.WriteLine(CommUtil.GetDefaultHtmlTag(PID, global.GetMenuTitle(PID, LANG_SET)));

				sw.WriteLine("<table id=\"report_table\" class=\"report\">");
				sw.WriteLine("<tr>");
				sw.WriteLine("<th>은행</th>");
				sw.WriteLine("<th>계좌명</th>");
				sw.WriteLine("<th>계좌번호</th>");
				sw.WriteLine("<th>예금주</th>");
				sw.WriteLine("<th>계좌개설일</th>");
				sw.WriteLine("<th>사용여부</th>");
				sw.WriteLine("</tr>");

				int rCount = DataSetUtil.GetRowCount(ds, tableName);
				for (int i = 0; i < rCount; i++)
				{
					string bnkCdNm = DataSetUtil.GetFldStr(ds, tableName, i, "Bnk_Cd_Nm");
					string accntNm = DataSetUtil.GetFldStr(ds, tableName, i, "Accnt_Nm");
					string accntNum = DataSetUtil.GetFldStr(ds, tableName, i, "Accnt_Num");
					string depositor = DataSetUtil.GetFldStr(ds, tableName, i, "Depositor");
					string accntStDt = DataSetUtil.GetFldStr(ds, tableName, i, "Accnt_St_Dt");
					string useYn = DataSetUtil.GetFldStr(ds, tableName, i, "Use_Yn");

					sw.WriteLine("<tr>");
					sw.WriteLine("<td class=\"lbl\">" + bnkCdNm + "</td>");
					sw.WriteLine("<td class=\"lbl\">" + accntNm + "</td>");
					sw.WriteLine("<td class=\"lbl\">" + accntNum + "</td>");
					sw.WriteLine("<td class=\"lbl_c\">" + depositor + "</td>");
					sw.WriteLine("<td class=\"lbl_c\">" + accntStDt + "</td>");
					sw.WriteLine("<td class=\"lbl_c\">" + useYn + "</td>");
					sw.WriteLine("</tr>");
				}
				sw.WriteLine("</table>");
				sw.WriteLine("<script type=\"text/javascript\" language=\"javascript\" defer=\"defer\">");
				sw.WriteLine("TableRowspan(report_table, '0');");
				sw.WriteLine("</script>");
				sw.WriteLine("</body>");
				sw.WriteLine("</html>");

				sw.Close();
			}
			catch (Exception e)
			{
				Base.AppFramework.SMEventLog.WriteExceptionLog(e);
				CallMsgBoxInAjax("MSG_ERR_122");	//파일을 생성하지 못했습니다
			}
		}

		#endregion

		#region CRUD (SelectProcess, InsertProcess, UpdateProcess, DeleteProcess, SearchProcess)

		//조회
		private void SelectProcess()
		{
			DataSet lo_ds = new DataSet();
			DataPack lo_dp = new DataPack();
			int li_page_count;

			//검색
			lo_dp.AddProperty("ls_accnt_nm", typeof(string), kw1);
			lo_dp.AddProperty("ls_accnt_num", typeof(string), kw2);
			lo_dp.AddProperty("ls_depositor", typeof(string), kw3);
			lo_dp.AddProperty("ls_use_yn", typeof(string), kw4);

			using (Mny1010m_NT _Mny1010m_NT = new Mny1010m_NT())
			{
				li_row_count = _Mny1010m_NT.GetSearchCount(lo_dp);	// 검색된 행수
				li_page_count = (int)((li_row_count - 1) / li_page_size) + 1;	// 총페이지수 계산

				//모두보기/페이징
				lo_dp.AddProperty("li_st_page", typeof(Int32), (cb_list_all.Checked) ? 0 : li_st_page);
				lo_dp.AddProperty("li_ed_page", typeof(Int32), (cb_list_all.Checked) ? li_row_count : li_ed_page);
				lo_dp.AddProperty("ls_lang_set", typeof(string), LANG_SET);
				lbl_page.Visible = !cb_list_all.Checked;

				lo_ds.Merge(_Mny1010m_NT.SelectProcess(lo_dp));

				GridView1.DataSource = lo_ds;
				GridView1.DataBind();

				Pager pager = new Pager(this, ref lbl_page);
				pager.PageNavigation(
					li_cur_page,
					li_page_count,
					gs_path_info + "?sm=" + gs_sm + "&kw1=" + Server.UrlEncode(kw1) + "&kw2=" + Server.UrlEncode(kw2) + "&kw3=" + Server.UrlEncode(kw3) + "&kw4=" + Server.UrlEncode(kw4) + "&page=");

				//결과출력(키워드, 검색행수)
				ShowKeywordLabel();
				lbl_result_count.Text = li_row_count.ToString("#,###,##0");
			}
		}

		//저장
		private void InsertProcess()
		{
			using (Mny1010m_RT _Mny1010m_RT = new Mny1010m_RT())
			{
				int li_return = _Mny1010m_RT.InsertProcess(SetValue());
				string ls_msg_id = (li_return > 0) ? "MSG_INF_007" : "MSG_ERR_105";	//저장되었습니다:저장할 수 없습니다
				CallMsgBoxInAjax(ls_msg_id);

				SearchProcess();
			}
		}

		//수정
		private void UpdateProcess()
		{
			using (Mny1010m_RT _Mny1010m_RT = new Mny1010m_RT())
			{
				int li_return = _Mny1010m_RT.UpdateProcess(SetValue());
				string ls_msg_id = (li_return > 0) ? "MSG_INF_006" : "MSG_ERR_104";	//수정되었습니다:수정할 수 없습니다
				CallMsgBoxInAjax(ls_msg_id);

				SearchProcess();
			}
		}

		//삭제
		private void DeleteProcess(string ls_xml)
		{
			using (Mny1010m_RT _Mny1010m_RT = new Mny1010m_RT())
			{
				int li_return = _Mny1010m_RT.DeleteProcess(ls_xml);
				string ls_msg_id = (li_return > 0) ? "MSG_INF_004" : "MSG_ERR_103";	//삭제되었습니다:삭제할 수 없습니다
				CallMsgBoxInAjax(ls_msg_id);

				SearchProcess();
			}
		}

		//검색
		private void SearchProcess()
		{
			lbl_search_flag.Text = "SEARCH";
			SetSearchParameter();
			ClearValue();
			SelectProcess();
		}

		#endregion

		#region SetValue, ClearValue

		//SetValue
		private DataPack SetValue()
		{
			DataPack lo_dp = new DataPack();

			lo_dp.AddProperty("Seq",		typeof(string),		lbl_pk.Text);
			lo_dp.AddProperty("Bnk_Cd",		typeof(string), 	ddl_bnk_cd.SelectedValue);
			lo_dp.AddProperty("Accnt_Cd",	typeof(string), 	ddl_accnt_cd.SelectedValue);
			lo_dp.AddProperty("Accnt_Nm",	typeof(string), 	ConversionUtil.DefaultValue(txt_accnt_nm.Text));
			lo_dp.AddProperty("Accnt_Num",	typeof(string), 	ConversionUtil.DefaultValue(txt_accnt_num.Text));
			lo_dp.AddProperty("Depositor",	typeof(string), 	ConversionUtil.DefaultValue(txt_depositor.Text));
			//lo_dp.AddProperty("Accnt_Pw",	typeof(string), 	ConversionUtil.DefaultValue(txt_accnt_pw.Text));
			lo_dp.AddProperty("Accnt_St_Dt", typeof(string), 	ConversionUtil.DefaultValue(txt_accnt_st_dt.Text));
			lo_dp.AddProperty("Accnt_Ed_Dt", typeof(string), 	ConversionUtil.DefaultValue(txt_accnt_ed_dt.Text));
			lo_dp.AddProperty("iBnk_Url",	typeof(string), 	ConversionUtil.DefaultValue(txt_ibnk_url.Text));
			lo_dp.AddProperty("iBnk_Id",	typeof(string), 	ConversionUtil.DefaultValue(txt_ibnk_id.Text));
			//lo_dp.AddProperty("iBnk_Pw",	typeof(string), 	ConversionUtil.DefaultValue(txt_ibnk_pw.Text));
			//lo_dp.AddProperty("iBnk_Tran_Pw", typeof(string), 	ConversionUtil.DefaultValue(txt_ibnk_tran_pw.Text));
			lo_dp.AddProperty("Use_Yn",		typeof(string), 	rbl_use_yn.SelectedValue);
			lo_dp.AddProperty("Remark",		typeof(string), 	ConversionUtil.DefaultValue(txt_remark.Text));
			lo_dp.AddProperty("Create_User", typeof(string), 	USER_ID);
			lo_dp.AddProperty("Create_Dt",	typeof(string), 	"");
			lo_dp.AddProperty("Update_User", typeof(string), 	USER_ID);
			lo_dp.AddProperty("Update_Dt", typeof(string),		"");

			string ls_accnt_pw = (txt_accnt_pw.Text.Trim() == "") ? lbl_accnt_pw.Text : crypto.Encrypt(txt_accnt_pw.Text);
			string ls_ibnk_pw = (txt_ibnk_pw.Text.Trim() == "") ? lbl_ibnk_pw.Text : crypto.Encrypt(txt_ibnk_pw.Text);
			string ls_ibnk_tran_pw = (txt_ibnk_tran_pw.Text.Trim() == "") ? lbl_ibnk_tran_pw.Text : crypto.Encrypt(txt_ibnk_tran_pw.Text);			
			
			lo_dp.AddProperty("Accnt_Pw",	typeof(string), ls_accnt_pw);
			lo_dp.AddProperty("iBnk_Pw",	typeof(string), ls_ibnk_pw);
			lo_dp.AddProperty("iBnk_Tran_Pw",	typeof(string), ls_ibnk_tran_pw);			
			
			return lo_dp;
		}

		//ClearValue
		private void ClearValue()
		{
			lbl_pk.Text = "";
			h_no.Value = "";
			ddl_bnk_cd.SelectedIndex = 0;
			ddl_accnt_cd.SelectedIndex = 0;
			txt_accnt_nm.Text = "";
			txt_accnt_num.Text = "";
			txt_depositor.Text = "";
			txt_accnt_pw.Text = "";
			ce_accnt_st_dt.SelectedDate = DateTime.Now.AddDays(0);
			ce_accnt_ed_dt.SelectedDate = DateTime.Now.AddDays(0);
			txt_ibnk_url.Text = "";
			txt_ibnk_id.Text = "";
			txt_ibnk_pw.Text = "";
			txt_ibnk_tran_pw.Text = "";
			txt_remark.Text = "";
		}

		#endregion

		#region Page_PreRender, ChangePageMode

		// Page_PreRender
		private void Page_PreRender(object sender, System.EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				using (AccessCheck access = new AccessCheck())
				{
					//접근권한 체크
					if (!access.CheckPgmAccessGrant(PID, USER_ID, ACCESS_LOG_INFO))
					{
						Response.Redirect(URL_NO_AUTHORITY_REDIRECT_BASE);	//사용자의 권한은 요청하신 페이지를 볼 수 없습니다
					}
					//사용권한별 버튼처리
					PagePreRender.SetVisibleCtrl(this, access.CheckPgmUsingGrant(USER_DIV, PID), access.GetVisibleCtrl(PID));
				}
			}
			ChangePageMode();
		}

		// ChangePageMode
		private void ChangePageMode()
		{
			SetGridViewHeader(global.GetColumnListByPgmId(PID, LANG_SET));
		}

		#endregion

		#region GridView이벤트

		//RowDataBound
		protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
		{
			if (e.Row.RowType == DataControlRowType.DataRow)
			{
				//마우스올렸을 때
				e.Row.Attributes.Add("onmouseover", "overBackground('GridView1', " + (e.Row.RowIndex + 1) + ")");
				e.Row.Attributes.Add("onmouseout", "outBackground('GridView1', 1)");

				//번호
				e.Row.Cells[1].Text = ((li_row_count - ((li_cur_page - 1) * li_page_size)) - e.Row.RowIndex).ToString();

				//비고
				e.Row.Cells[8].Attributes.Add("title", GridView1.DataKeys[e.Row.RowIndex].Values["Remark"].ToString());

				//사용여부
				switch (e.Row.Cells[18].Text)
				{
					case "Y" :
						e.Row.Cells[18].Attributes.Add("class", "color_darkred");
						break;
					case "N":
						e.Row.Cells[18].Attributes.Add("class", "color_gray");
						break;
					default:
						break;
				}
			}

			//머지
			SMGridView sGv = new SMGridView(this.Page, ref GridView1);
			sGv.RowSpanGridView(GridView1, 4);//Bnk_Cd_Nm
		}

		//RowCommand
		protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
		{
			GridView gv = (GridView)sender;
			GridViewRow row = (GridViewRow)(((Control)e.CommandSource).NamingContainer);

			LinkButton lbtn_rc = (LinkButton)GridView1.Rows[row.RowIndex].FindControl("lbtn_rc");

			//row.Cells[0].Text.ToString();//0.체크박스
			h_no.Value					= row.Cells[1].Text.ToString();									//1.번호
			lbl_pk.Text					= gv.DataKeys[row.RowIndex].Values["Seq"].ToString();			//2.Seq
			ddl_bnk_cd.SelectedValue	= gv.DataKeys[row.RowIndex].Values["Bnk_Cd"].ToString();		//3.Bnk_Cd
																										//4.Bnk_Cd_Nm
			ddl_accnt_cd.SelectedValue	= gv.DataKeys[row.RowIndex].Values["Accnt_Cd"].ToString();		//5.Accnt_Cd
																										//6.Accnt_Cd_Nm
			txt_accnt_nm.Text			= row.Cells[7].Text.Trim();										//7.Accnt_Nm
			txt_accnt_num.Text			= lbtn_rc.Text;													//8.Accnt_Num (template)
			txt_depositor.Text			= row.Cells[9].Text.Trim();										//9.Depositor
			lbl_accnt_pw.Text			= gv.DataKeys[row.RowIndex].Values["Accnt_Pw"].ToString();		//10.Accnt_Pw
			txt_accnt_st_dt.Text		= row.Cells[11].Text.Trim();									//11.Accnt_St_Dt
			txt_accnt_ed_dt.Text		= row.Cells[12].Text.Trim();									//12.Accnt_Ed_Dt
			txt_ibnk_url.Text			= gv.DataKeys[row.RowIndex].Values["iBnk_Url"].ToString();		//13.iBnk_Url
			txt_ibnk_id.Text			= row.Cells[14].Text.Trim();									//14.iBnk_Id
			lbl_ibnk_pw.Text			= gv.DataKeys[row.RowIndex].Values["iBnk_Pw"].ToString();		//15.iBnk_Pw
			lbl_ibnk_tran_pw.Text		= gv.DataKeys[row.RowIndex].Values["iBnk_Tran_Pw"].ToString();	//16.iBnk_Tran_Pw
			txt_remark.Text				= gv.DataKeys[row.RowIndex].Values["Remark"].ToString();		//17.Remark
			rbl_use_yn.SelectedValue	= row.Cells[18].Text.Trim();									//18.Use_Yn
																										//19.비밀번호
		}

		#endregion

		#region 버튼이벤트

		//검색
		protected void ibtn_search_Click(object sender, EventArgs e)
		{
			SearchProcess();
		}

		//저장
		protected void ibtn_save_Click(object sender, EventArgs e)
		{
			if (global.CheckSaveMode("UPDMS_MNY_BNK_ACCNT_INFO", "Seq", lbl_pk.Text.Trim()))
			{
				UpdateProcess();
			}
			else
			{
				lbl_accnt_pw.Text = lbl_ibnk_pw.Text = lbl_ibnk_tran_pw.Text = crypto.Encrypt("");	//처음저장시 빈값
				InsertProcess();
			}
		}

		//삭제
		protected void ibtn_delete_Click(object sender, EventArgs e)
		{
			StringBuilder sb = new StringBuilder();

			sb.Append("<UPDMS>");

			for (int i = 0; i < GridView1.Rows.Count; i++)
			{
				GridViewRow row = GridView1.Rows[i];
				HtmlInputCheckBox cb = (HtmlInputCheckBox)row.FindControl("cb_check");

				if (cb.Checked)
				{
					string ls_seq = GridView1.DataKeys[i].Values["Seq"].ToString();
					sb.Append("<UPDMS_MNY_BNK_ACCNT_INFO>");
					sb.Append("<Seq>" + ls_seq + "</Seq>");
					sb.Append("</UPDMS_MNY_BNK_ACCNT_INFO>");
				}
			}
			sb.Append("</UPDMS>");

			DeleteProcess(sb.ToString());
		}

		//엑셀
		protected void ibtn_excel_Click(object sender, EventArgs e)
		{
			SetSearchParameter();

			DataSet lo_ds = new DataSet();
			DataPack lo_dp = new DataPack();

			lo_dp.AddProperty("ls_accnt_nm", typeof(string), kw1);
			lo_dp.AddProperty("ls_accnt_num", typeof(string), kw2);
			lo_dp.AddProperty("ls_depositor", typeof(string), kw3);
			lo_dp.AddProperty("ls_use_yn", typeof(string), kw4);

			using (Mny1010m_NT _Mny1010m_NT = new Mny1010m_NT())
			{
				li_row_count = _Mny1010m_NT.GetSearchCount(lo_dp);

				lo_dp.AddProperty("li_st_page", typeof(Int32), 0);
				lo_dp.AddProperty("li_ed_page", typeof(Int32), li_row_count);
				lo_dp.AddProperty("ls_lang_set", typeof(string), LANG_SET);

				lo_ds.Merge(_Mny1010m_NT.SelectProcess(lo_dp));
			}
			string fileName = PID + "(" + global.GetMenuTitle(PID, LANG_SET) + ")";
			ExcelUtil.CreateExcelFileX(this.Page, fileName, lo_ds, SetExcelHeaderX(global.GetColumnListByPgmId(PID, LANG_SET)));
		}

		//FTP
		protected void ibtn_ftp_Click(object sender, EventArgs e)
		{
			string fileName = PID + ".html";
			FtpClient fc = new FtpClient(FTP_HOSTNAME, FTP_USERID, crypto.Decrypt(FTP_PASSWORD));

			try
			{
				SetSearchParameter();

				DataSet lo_ds = new DataSet();
				DataPack lo_dp = new DataPack();

				lo_dp.AddProperty("ls_accnt_nm", typeof(string), kw1);
				lo_dp.AddProperty("ls_accnt_num", typeof(string), kw2);
				lo_dp.AddProperty("ls_depositor", typeof(string), kw3);
				lo_dp.AddProperty("ls_use_yn", typeof(string), kw4);
				lo_dp.AddProperty("li_st_page", typeof(Int32), 0);
				lo_dp.AddProperty("li_ed_page", typeof(Int32), 1000);
				lo_dp.AddProperty("ls_lang_set", typeof(string), LANG_SET);

				using (Mny1010m_NT _Mny1010m_NT = new Mny1010m_NT())
				{
					lo_ds.Merge(_Mny1010m_NT.SelectProcess(lo_dp));
				}

				//파일생성
				CreateFileReal(fileName, lo_ds);

				//FTP전송
				if (FileUtil.IsFileExist(FILE_PATH_FTP_UPLOAD + "\\" + fileName))
				{
					fc.Login();
					fc.BinaryMode = false;

					string[] remoteDir = StringUtil.DelimitedListToStringArray(FTP_DIR_IPHONE_MNY, "/");
					for (int i = 0; i < remoteDir.Length; i++)
					{
						fc.ChangeDir(remoteDir[i]);
					}

					if (fc.IsFileExist(fileName))
					{
						fc.DeleteFile(fileName);
					}

					fc.UploadOnlyFile(FILE_PATH_FTP_UPLOAD, fileName, "", "", true);
					fc.Close();
				}
				else
				{
					CallMsgBoxInAjax("MSG_ERR_164");	//전송할 파일이 없습니다.
				}
				CallMsgBoxInAjax("MSG_INF_018");	//전송되었습니다
			}
			catch (Exception ex)
			{
				CallExceptionMsgBoxInAjax(ex);
			}
			finally
			{
				fc.Close();
			}
		}

		//모두보기
		protected void cb_list_all_CheckedChanged(object sender, EventArgs e)
		{
			SearchProcess();
		}

		#endregion

	}
}
